package com.bt.dmdb.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "ODS_USER")
@SuppressWarnings("serial")
public class User implements java.io.Serializable {

    private long id;
    private Region region;
    private SubRegion subRegion;
    private String expedioLogin;
    private Long ein;
    private String name;
    private String jobTitle;
    private String phone;
    private Set<ProjectUser> projectUsers = new HashSet<ProjectUser>(0);
    private Set<ProjectSite> projectSites = new HashSet<ProjectSite>(0);
    private Set<UserRole> userRoles = new HashSet<UserRole>(0);

    public User() {
    }

    public User(long id) {
        this.id = id;
    }

    public User(long id, Region region, SubRegion subRegion, String expedioLogin, Long ein, String name, String jobTitle, String phone, Set<ProjectUser> projectUsers, Set<ProjectSite> projectSites, Set<UserRole> userRoles) {
        this.id = id;
        this.region = region;
        this.subRegion = subRegion;
        this.expedioLogin = expedioLogin;
        this.ein = ein;
        this.name = name;
        this.jobTitle = jobTitle;
        this.phone = phone;
        this.projectUsers = projectUsers;
        this.projectSites = projectSites;
        this.userRoles = userRoles;
    }

    @Id
    @Column(name = "ID", unique = true, nullable = false, precision = 10, scale = 0)
    public long getId() {
        return this.id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "USER_REGION")
    public Region getRegion() {
        return this.region;
    }

    public void setRegion(Region region) {
        this.region = region;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "USER_SUB_REGION")
    public SubRegion getSubRegion() {
        return this.subRegion;
    }

    public void setSubRegion(SubRegion subRegion) {
        this.subRegion = subRegion;
    }

    @Column(name = "EXPEDIO_LOGIN", length = 50)
    public String getExpedioLogin() {
        return this.expedioLogin;
    }

    public void setExpedioLogin(String expedioLogin) {
        this.expedioLogin = expedioLogin;
    }

    @Column(name = "EIN", precision = 10, scale = 0)
    public Long getEin() {
        return this.ein;
    }

    public void setEin(Long ein) {
        this.ein = ein;
    }

    @Column(name = "NAME", length = 50)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "JOB_TITLE", length = 50)
    public String getJobTitle() {
        return this.jobTitle;
    }

    public void setJobTitle(String jobTitle) {
        this.jobTitle = jobTitle;
    }

    @Column(name = "PHONE", length = 20)
    public String getPhone() {
        return this.phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
    public Set<ProjectUser> getProjectUsers() {
        return this.projectUsers;
    }

    public void setProjectUsers(Set<ProjectUser> projectUsers) {
        this.projectUsers = projectUsers;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
    public Set<ProjectSite> getProjectSites() {
        return this.projectSites;
    }

    public void setProjectSites(Set<ProjectSite> projectSites) {
        this.projectSites = projectSites;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
    public Set<UserRole> getUserRoles() {
        return this.userRoles;
    }

    public void setUserRoles(Set<UserRole> userRoles) {
        this.userRoles = userRoles;
    }
}
